<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 100%;
        }

        ul {
            width: 1000px;
            list-style: none;
            display: flex;
            flex-flow: wrap;
            margin: auto;
        }

        li {
            margin: 10px;
            position: relative;
        }

        img {
            width: 100px;
        }

        span {
            position: absolute;
            bottom: -20px;
            left: 45px;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li>
                <img src="/JS/基础/imgs/2.jpg" alt="">
                <span>我</span>
            </li>
            <li>
                <img src="/JS/基础/imgs/2.jpg" alt="">
                <span>我</span>
            </li>
            <li>
                <img src="/JS/基础/imgs/2.jpg" alt="">
                <span>我</span>
            </li>
        </ul>
    </div>

    <script>
        let imgs = [
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
            { "name": "我", "icon": "/JS/基础/imgs/2.jpg" },
        ]

        //      <li>
        //         <img src="/JS/基础/imgs/2.jpg" alt="">
        //         <span>我</span>
        //      </li>

        let ul = document.getElementsByTagName('ul')[0]



        for (let i = 0; i < imgs.length; i++) {
            console.log(imgs[i] + '索引为' + [i]);
            console.log(imgs[i].icon);
            console.log(imgs[i].name);

            // <img src="imgs[i].icon">  <span>我</span>
            ul.innerHTML += '<li>' + '<img src="' + imgs[i].icon + '"">' + '<span>' + imgs[i].name + '</span>' + '</li>'
        }
    </script>

</body>

</html>